package com.example.demo.service.Impl;

import com.example.demo.controller.UserController;
import com.example.demo.mapper.UserMapper;
import com.example.demo.pojo.ResultCode;
import com.example.demo.pojo.User;
import com.example.demo.service.UserService;
import com.github.pagehelper.util.StringUtil;
import org.omg.CORBA.portable.ApplicationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public User selectByUserName(String username) {

        return userMapper.selectByUserName(username);
    }

    @Override
    public User login(String username, String password) {
        //2.根据用户名查询用户
        User user=selectByUserName(username);

        if(user.getPassword().equals(password))
        {
            return user;
        }
        return null;
    }
}
